#ifndef SCENE_H
#define SCENE_H

#include <QGraphicsScene>
#include "global.h"

#include "point3d.h"

class Toolbar;
class SceneToolbarData;

O_PRIVATE_DECLARE(Scene);
class Scene : public QGraphicsScene
{
Q_OBJECT
public:
    enum Holder{
        flow,
        top,
        bottom,
        left,
        right
    };

    Scene(QObject *parent = 0);
    ~Scene();
    void drawBackground(QPainter *painter, const QRectF &rect);
    void setMainMenu(QGraphicsItem* item);
    void setToolbar(QList<QAction *> actions, Holder place, int type = 0);
    void installToolbar(Toolbar* toolbar, Holder place, int type = 0, QGraphicsItem* parent = 0);

    void setActiveItem(QGraphicsItem* item);
signals:

public slots:
    void refresh();
    void toolbarsShow();
    void toolbarsHide();

    void invisibleToolbars();
    void visibleToolbars();
    void checkMouse();
 protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    void wheelEvent(QGraphicsSceneWheelEvent * wheelEvent);


private:
    bool isOnToolbar(const QPointF& point, SceneToolbarData& td);
    void updateDistance();
    O_PRIVATE_DECLARE_MEMBER(Scene);
};

#endif // SCENE_H
